请解释一下我为什么没有Log?我想知道紧急拨号器是打开还是关闭。我试过这段代码,但什么也没发生。
n = RTurk::Notification.new("https://sqs.us-east-1.amazonaws.com/971351813114/MechanicalTurk", "SQS", "2006-05-05", "AssignmentAccepted")
a = RTurk.SetHITTypeNotification(:hit_type_id => "3M36IJVRR974ABAC76WQ0TCVKX9SIA", :notification => n, :active => true)
t = RTurk.SendTestEventNotification(:notification => n, :test_event_type => "AssignmentAccepted")
我如何拨打紧急拨号器和我的服务:
public class MyService2 extends Service {
public MyService2() {
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
ActivityManager activityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE );
List<ActivityManager.RunningAppProcessInfo> procInfos = activityManager.getRunningAppProcesses();
for(int i = 0; i < procInfos.size(); i++){
if(procInfos.get(i).processName.equals("com.android.phone.EmergencyDialer.DIAL"))
{
Log.i("Result", "App is running - Doesn't need to reload");
}
}
}
}
答案 0 :(得分:0)
请另外覆盖3个功能:
public void onCreate()
{
Log.i(TAG, "Service onCreate--->");
super.onCreate();
}
@Override
public void onStart(Intent intent, int startId)
{
Log.i(TAG, "Service onStart--->");
super.onStart(intent, startId);
}
@Override
public void onDestroy()
{
Log.i(TAG, "Service onDestroy--->");
super.onDestroy();
}