Created
October 11, 2012 00:48
-
-
Save masarugen/3869475 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hogehoge.android.simoperatorname; | |
import org.appcelerator.kroll.KrollModule; | |
import org.appcelerator.kroll.annotations.Kroll; | |
import org.appcelerator.titanium.TiApplication; | |
import org.appcelerator.kroll.common.Log; | |
import org.appcelerator.kroll.common.TiConfig; | |
import android.app.Activity; | |
import android.telephony.TelephonyManager; | |
import android.content.Context; | |
@Kroll.module(name="Simoperatorname", id="hogehoge.android.simoperatorname") | |
public class SimoperatornameModule extends KrollModule | |
{ | |
// Standard Debugging variables | |
private static final String LCAT = "SimoperatornameModule"; | |
private static final boolean DBG = TiConfig.LOGD; | |
// You can define constants with @Kroll.constant, for example: | |
// @Kroll.constant public static final String EXTERNAL_NAME = value; | |
public SimoperatornameModule() | |
{ | |
super(); | |
} | |
@Kroll.onAppCreate | |
public static void onAppCreate(TiApplication app) | |
{ | |
Log.d(LCAT, "inside onAppCreate"); | |
// put module init code that needs to run when the application is created | |
} | |
// Methods | |
@Kroll.method | |
public String getSimOperatorName() | |
{ | |
Activity activity = TiApplication.getAppRootOrCurrentActivity(); | |
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE); | |
String spn = tm.getSimOperatorName(); | |
Log.d(LCAT, "inside getSimOperatorName:" + spn); | |
return spn; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment