小编Reg*_*_AG的帖子

Android:如何知道MediaPlayer是否暂停?

MediaPlayer.isPlaying()不允许知道MediaPlayer是停止还是暂停.如何知道它是否暂停而未停止?

谢谢 !

java android stream media-player android-mediaplayer

16
推荐指数
2
解决办法
9846
查看次数

Android应用内结算:什么是"开发者有效负载"以及"购买"按钮的工作原理?

我正在使用Google应用内结算示例应用"Dungeons".

在这个应用程序中,我可以点击"购买"按钮购买东西或点击"编辑有效载荷"按钮...编辑有效载荷:).但是我不明白这个按钮是什么以及"编辑有效载荷"的含义......任何人都能澄清一下吗?

顺便说一句,任何人都可以告诉我"购买"按钮是如何触发购买行为的,因为"地下城"应用程序中的代码如下(购买行动是由我发明的,我不明白......):

public void onClick(View v) {
        if (v == mBuyButton) {
            // NO CODE HERE TO DO SOMETHING ???!!!
            if (!mBillingService.requestPurchase(mSku, mPayloadContents)) {
                showDialog(DIALOG_BILLING_NOT_SUPPORTED_ID);
            }
        } else if (v == mEditPayloadButton) {
            showPayloadEditDialog();
        }
    }
Run Code Online (Sandbox Code Playgroud)

谢谢 !

android payload in-app-purchase in-app-billing google-play

15
推荐指数
2
解决办法
1万
查看次数

如何获得用户首选单位?(公制(米)或英制(英里))?

我想知道英里和米之间的用户首选单位是什么.似乎"Locale"类不允许这样做.

java eclipse android metric units-of-measurement

14
推荐指数
2
解决办法
1万
查看次数

XCode:为什么didFinishLaunchingWithOptions中的launchOptions总是为零?

当点击通知启动应用程序时,我希望我的应用程序执行特定的操作.当应用程序已经运行到后台时我想做这些特定的事情但是当通过点击通知启动应用程序FROM SCRATCH(没有运行到后台)时.

当通过点击通知从后台启动应用程序时,我通过以下方式获得通知:

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
Run Code Online (Sandbox Code Playgroud)

=>没有问题!

当通过点击通知从头开始启动应用程序时,我希望通过以下方式获取通知:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

     UILocalNotification *localNotif = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

}
Run Code Online (Sandbox Code Playgroud)

但是launchOptions总是零!当应用程序通过点击应用程序图标(正常)从头开始,但是当通过点击通知(不正常)从头开始应用程序时,它是零.

有谁知道如何解决这个问题?

谢谢 !!!

编辑1

以下是我的通知创建方式(Joe问题):

  NSDictionary *userInfo = [NSDictionary dictionaryWithObjects:
[NSArray arrayWithObjects:notifText,latitudeString,longitudeString,nil]
forKeys:[NSArray arrayWithObjects:@"notifText",@"latitude",@"longitude", nil]];

    UILocalNotification *localNotif = [[UILocalNotification alloc] init];
    localNotif.fireDate = itemDate;
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    localNotif.alertBody =msg;
    localNotif.alertAction = @"Ok";
    localNotif.soundName = UILocalNotificationDefaultSoundName;
    localNotif.applicationIconBadgeNumber = 1;
    localNotif.userInfo = userInfo;

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
    [localNotif release];
Run Code Online (Sandbox Code Playgroud)

编辑2(回答我的问题!:))

这是我用来调试我的应用程序但是...这个程序错了!

  1. 我在"编辑方案"菜单中设置了"等待MyApp.app启动"选项的调试器
  2. 我第一次使用XCode启动了我的应用程序(从头开始)XCode显示"等待我的MyApp启动"=>我点击我的应用程序图标启动应用程序
  3. 应用程序启动=>我点击主页按钮=>显示通知
  4. 我点击XCode中的停止按钮关闭应用程序我用XCode重新启动它=> XCode再次显示"等待我的MyApp启动"消息=>我点击状态栏中的通知启动应用程序
  5. => launchOptions is …

xcode notifications startup push-notification ios

13
推荐指数
1
解决办法
2万
查看次数

Android NDK:我应该在Application.mk中为APP_ABI设置什么?

我想知道我应该在Android游戏的Application.mk文件中放置哪些架构.

我想支持所有可以在Google Play和其他类型的Android商店下载游戏的平台.

我会说我应该设置:

APP_ABI := armeabi x86 (as many x86 devices are coming soon as far as I know)
Run Code Online (Sandbox Code Playgroud)

但我想知道我是否应该设置:

APP_ABI := armeabi armeabi-v7a x86
Run Code Online (Sandbox Code Playgroud)

要么

APP_ABI := all
Run Code Online (Sandbox Code Playgroud)

请澄清.

x86 android arm abi android-ndk

13
推荐指数
2
解决办法
2万
查看次数

XCode/Mac:键入"OR"符号"||"的键盘快捷键 (双竖杆)?

每次我都要复制粘贴"||" 从其他地方我想要输入OR符号的双垂直条.

无法在Google中找到相关信息.:(

有任何想法吗 ??

:-)

macos xcode keyboard-shortcuts

12
推荐指数
3
解决办法
5万
查看次数

AdMob中介(Android和iOS):如何强制网络进行测试?

我正在与多个第三方网络实施AdMob调解.我想测试一下这些网络的调解是否得到了很好的实施(广告很好地显示).

我想强制显示来自已定义网络的广告以测试其实施,然后快速切换到另一个网络.

一种方法是更改​​AdMob中介界面中的出价.例如,在我要测试的网络上放置100 $,在其他网络上放置0.1 $.

但问题是似乎在考虑更改之前有一些延迟,即使经过长时间的延迟,似乎我没有100%来自网络的广告100美元.

我如何强制网络(任何测试模式?)的方式,我将立即从这个网络广告100%的请求?它可能是来自此网络的测试广告.

谢谢 !

android admob ios mopub inmobi

12
推荐指数
1
解决办法
1118
查看次数

Android Market - 开发者控制台:营销启用/禁用?

在Android Market开发者控制台中,在我的应用程序的配置文件中,有一个可以选中或取消选中的框,允许"禁用"或"启用"营销.

这是什么意思 ??

谢谢 !

android google-play

11
推荐指数
1
解决办法
5935
查看次数

Android:如何获得用户的性别和年龄?

我有一个Android应用程序,我想根据用户的性别和年龄自动设置.

获得用户年龄和性别的不同方法有哪些?(符合Google Play政策)

例如,有没有办法通过Google Play服务获取这些信息?

谢谢.

java android google-play google-play-services

11
推荐指数
1
解决办法
8117
查看次数

android.app.RemoteServiceException:在android.app.ActivityThread $ H.handleMessage发送通知时

我使用服务来显示通知.在一些罕见的设备上(每天5万用户中有3个用户),我遇到了以下崩溃(可以在Google Play开发者控制台中看到;仅在Android 4.x设备上):

android.app.RemoteServiceException: 
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
  at android.os.Handler.dispatchMessage(Handler.java:110)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:5327)
  at java.lang.reflect.Method.invokeNative(Native Method:0)
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
  at dalvik.system.NativeStart.main(Native Method:0)
Run Code Online (Sandbox Code Playgroud)

我的通知是用这样的代码制作的(旧式通知,在Android 6+中已弃用,但无论如何都有效;该错误发生在Android 4.x上,其中代码不被弃用):

Notification notification = new Notification(icon, "Custom Notification", when);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification);
contentView.setImageViewResource(R.id.notifWeatherImageView, WeatherRowTools.getImageForWeatherCode(weatherCodeString));

....some stuff here...

notification.contentView = contentView;
notification.contentIntent = contentIntent;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults = 0;
mNotificationManager.notify(1, notification);
Run Code Online (Sandbox Code Playgroud)

有关如何解决这个问题的任何想法?

非常感谢 !!!

java notifications android push-notification android-notifications

11
推荐指数
1
解决办法
3526
查看次数