开发者

Android receive sms only works in emulator (onReceive not called?)

开发者 https://www.devze.com 2023-04-12 09:51 出处:网络
Iam coding a little gps tracker wo sends me the gps coordinates when it receives a sms. It works with 2 emulators and I get the message with the gps coordinates.

Iam coding a little gps tracker wo sends me the gps coordinates when it receives a sms.

It works with 2 emulators and I get the message with the gps coordinates.

Then I tried it on my HTC Desire and send myself an sms.

But nothing happend! Normally when the onReceive is called it shows a message with toast and sends an sms with gps coordinates but nothing is happening ;-/

Here the manifest:

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".GPSActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <receiver android:name=".SmsReceiver" android:enabled="true"> 
        <intent-filter> 
            <action android:name=
                "android.provider.Telephony.SMS_RECEIVED" /> 
        </intent-filter> 
    </receiver>
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
 <uses-permission and开发者_Python百科roid:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/>

any ideas?

Ps.: The code is in my last thread HERE

THANKS!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号