Tuesday, April 8, 2014

Talk about the real state receives less than broadcasting system





2.3 The machine can receive phone status, call the broadcast numbers, receiving less than 4.0, the other did not test, solving What is the situation? After the system is not listening to, abortBroadcast () out?
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Make sure these two permissions:
 


Then determine BroadcastReceiver have not registered on.
android.intent.action.PHONE_STATE not orderly broadcasting, if the above two no problem, should be able to received.
android.intent.action.NEW_OUTGOING_CALL is orderly broadcasting, if suspicion by other applications abort the case, put your BroadcastReceiver to set a higher priority, if you can receive it.

Reply:
Permissions are added, I was in AndroidManifest.xml, Registered should be no problem, but still does not receive this broadcast android.intent.action.PHONE_STATE priority over common sense, then I have Integer.MAXVALUE, the result was not receiving to
Reply:
Priority is only useful for the orderly broadcast.
Android.intent.action.NEW_OUTGOING_CALL receive this broadcast it?
Reply:
Both are not received, a broadcast Broadcas receives two action settings should be no problem, right?
Reply:
Look at the code posted
Reply:
I was
registered directly in the AndroidManifest.xml





Virtual machine test, the real machine failure

Reply:

I was directly in AndroidManifest.xml registration:
reference to the 6th floor lh1134520120 reply





Virtual machine test, the real machine failed

MyReceiver stickers out
Reply:
reference to the 7th floor tantahe reply:
Quote: references to the 6th floor lh1134520120 reply:

I was
registered directly in the AndroidManifest.xml





Virtual machine test, the real machine failed

MyReceiver stickers out


 package com.test.servicedemo; 

import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;

public class MyReceiver extends BroadcastReceiver {

@ Override
public void onReceive (Context context, Intent intent) {
System.out.println ("-----------------------------");
/ / If the call
if (intent.getAction (). equals (Intent.ACTION_NEW_OUTGOING_CALL)) {
String phoneNumber = intent
. GetStringExtra (Intent.EXTRA_PHONE_NUMBER);
System.out.println ("call:" + phoneNumber);
} Else {
/ / If the caller
TelephonyManager tm = (TelephonyManager) context
. GetSystemService (Service.TELEPHONY_SERVICE);
tm.listen (listener, PhoneStateListener.LISTEN_CALL_STATE);
}
}

PhoneStateListener listener = new PhoneStateListener () {
@ Override
public void onCallStateChanged (int state, String incomingNumber) {
/ / Note that the method must be written on the back super method, otherwise incomingNumber not get to the value.
super.onCallStateChanged (state, incomingNumber);
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
Log.e ("-----------", "hang up");
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.e ("-----------", "answer");
break;
case TelephonyManager.CALL_STATE_RINGING:
Log.e ("-----------", "Ring: Caller ID" + incomingNumber);
/ / Output Caller ID
break;
}
}
};

}

Reply:
I also found this problem, the real machine can not receive
Reply:
reference to the 9th floor u012266949 reply:
I also found this problem, the real machine can not receive

I can use the machine to test 2.3, 3.0, did not try, there can be more than the 4.0
Reply:
reference to the 10th floor lh1134520120 reply:
Quote: references to the 9th floor u012266949 reply:

I also found this problem, the real machine can not receive

I can use the machine to test 2.3, 3.0, did not try, can not be more than 4.0

Well, also a friend asked me to say a real machine can not receive previously been a simulator can be, the real machine test it really is not, I do not know who to call to get to the show is how very puzzled
Reply:
reference to the 11th floor u012266949 reply:

Yes, ah, do not know the internal phone developers made a deal.
Reply:
This application is not without your Activity?
4.0 After this situation is limited, an APK if no Activity, only the Receiver or Service, Service or the Receiver is not activated, it can not receive broadcasts.
This restriction is to prevent some rogue software in the background recklessly.
Reply:
reference to the 13th floor tantahe reply:
you this application is not no Activity?
4.0 After this situation is limited, an APK if no Activity, only the Receiver or Service, Service or the Receiver is not activated, it can not receive broadcasts.
This restriction is to prevent some rogue software in the background recklessly.

Yes, but when I set the Activity can not receive.
Reply:
reference to the 14th floor lh1134520120 reply:
Quote: references to the 13th floor tantahe reply:

This application is not without your Activity?
4.0 After this situation is limited, an APK if no Activity, only the Receiver or Service, Service or the Receiver is not activated, it can not receive broadcasts.
This restriction is to prevent some rogue software in the background recklessly.

Yes, but when I set the Activity can not receive.

Activity to receive broadcasts after starting it?
Reply:
If the Activity never start too, but also receive broadcasts. Unless it is a system application.
Reply:
Started, and I started to start a Activity, registered broadcast Activity inside, and then call the phone did not respond.
Reply:
cited 17 floor lh1134520120 reply:
started, I started a start Activity, registered broadcast Activity inside, and then call the phone no response.

Your radio is not registered it in the Manifest
Reply:
cited 18 floor tantahe reply:
Quote: references to 17th floor lh1134520120 reply:

Started, and I started to start a Activity, registered broadcast Activity inside, and then call the phone did not respond.

Your radio is not registered in the Manifest in it


I want to register in the Manifest inside. Found not behind, so I tested both ways, to no avail.
Reply:
cited 19th floor lh1134520120 reply:
Quote: 18th Floor tantahe cited reply:

Quote: references to 17th floor lh1134520120 reply:

Started, and I started to start a Activity, registered broadcast Activity inside, and then call the phone did not respond.

Your radio is not registered in the Manifest in it


I want to register in the Manifest inside. Found not behind, so I tested both ways, to no avail.

Manifest broadcast or on the inside to register. Then your application to have a Activity, boot you run this Activity. After it has been able to receive the broadcast.
Reply:
cited 20 floor tantahe reply:
Quote: 19th Floor lh1134520120 cited reply:

Quote: 18th Floor tantahe cited reply:

Quote: references to 17th floor lh1134520120 reply:

Started, and I started to start a Activity, registered broadcast Activity inside, and then call the phone did not respond.

Your radio is not registered in the Manifest in it


I want to register in the Manifest inside. Found not behind, so I tested both ways, to no avail.

Manifest broadcast or on the inside to register. Then your application to have a Activity, boot you run this Activity. After it has been able to receive the broadcast.


Well, still no effect
Reply:

Reply:
cited 22 floor tantahe reply:


You have your own tests? The phone is not a problem?
Reply:
I tried it, yes. Code stickers to give you reference.
Broadcast Receiver:
 package com.example.boot; 

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BootReceiver extends BroadcastReceiver {

@ Override
public void onReceive (Context context, Intent intent) {
if (intent.getAction (). equals ("android.intent.action.PHONE_STATE")) {
Log.e ("boot", "boot ------ android.intent.action.PHONE_STATE");
} Else if (intent.getAction (). Equals ("android.intent.action.NEW_OUTGOING_CALL")) {
Log.e ("boot", "boot ------ android.intent.action.NEW_OUTGOING_CALL");
}
}

}


Activity, just start again like:
 
package com.example.boot;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class MainActivity extends Activity {

@ Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_main);
}

@ Override
public boolean onCreateOptionsMenu (Menu menu) {
/ / Inflate the menu; this adds items to the action bar if it is present
.getMenuInflater () inflate (R.menu.activity_main, menu);.
return true;
}

}


Manifest:
  
package = "com.example.boot"
android: versionCode = "1"
android: versionName = "1.0">

android: minSdkVersion = "8"
android: targetSdkVersion = "16" />








android: allowBackup = "true"
android: icon = "@ drawable / ic_launcher"
android: label = "@ string / app_name"
android: theme = "@ style / AppTheme">
android: name = "com.example.boot.MainActivity"
android: label = "@ string / app_name">

















Log print:

Reply:
Aha? Real test? Need to restart the phone?
Reply:
reference to the 25th floor lh1134520120 reply:
aha? Real test? Need to restart the phone?

On the real test passed, without rebooting, just after the start clicking Activity installed on it.
Reply:
cited 26 floor tantahe reply:
Quote: references to the 25th floor lh1134520120 reply:

Aha? Real test? Need to restart the phone?

On the real test passed, without rebooting, just after the start clicking Activity installed on it.


Well models problems. What is your machine to test?
Reply:
reference to the 27th floor lh1134520120 reply:
Quote: 26th Floor tantahe cited reply:

Quote: references to the 25th floor lh1134520120 reply:

Aha? Real test? Need to restart the phone?

On the real test passed, without rebooting, just after the start clicking Activity installed on it.


Well models problems. What is your machine to test?

MTK and full-chi are tried. . . . . .
Reply:
cited 28 floor tantahe reply:
Quote: references to the 27th floor lh1134520120 reply:

Quote: 26th Floor tantahe cited reply:

Quote: references to the 25th floor lh1134520120 reply:

Aha? Real test? Need to restart the phone?

On the real test passed, without rebooting, just after the start clicking Activity installed on it.


Well models problems. What is your machine to test?

MTK and full-chi are tried. . . . . .




I have not seen millet

No comments:

Post a Comment