我试图在我的AsyncTask中获取名为Opciones的类的上下文(这个类是唯一一个调用该任务的类),但我不知道该怎么做,我看到了一些像这样的代码:
      protected void onPostExecute(Long result) {
    Toast.makeText(Opciones.this,"Subiendo la foto. ¡Tras ser moderada empezara a ser votada!: ", Toast.LENGTH_LONG).show(); 
}
Run Code Online (Sandbox Code Playgroud)
但它对我不起作用它说: "No enclosing instance of the type Opciones in scope"
我在 Mac 上有一个 git 存储库,当我git status在终端中使用时,它说
On branch master
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
当我尝试从存储库中提取更改时 git pull repositoryName master
error: The following untracked working tree files would be overwritten by merge:
.DS_Store
Please move or remove them before you can merge.
Run Code Online (Sandbox Code Playgroud)
所以我试图删除它,git rm .DS_Store但它说
fatal: pathspec '.DS_Store' did not match any files
Run Code Online (Sandbox Code Playgroud)
然后我试图删除缓存文件并重新添加它git rm --cached . -r并git add .用的.gitignore指令,会忽略.DS_Store,但问题仍然存在。
我尝试了很多在不同帖子上看到的命令,但都没有成功。任何帮助,将不胜感激。
当用户点击推送通知时,我试图用网址打开浏览器,我在stackoverflow中搜索,我发现这个
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        startActivity(browserIntent);
Run Code Online (Sandbox Code Playgroud)
但它不适合我,当我把通知没有出现,我调试它,它只抛出类文件编辑器没有错误或任何东西.
这是代码
   public void mostrarNotificacion(Context context, String body,String title, String icon, String url,String superior)
{
    String ns = Context.NOTIFICATION_SERVICE;
    NotificationManager notManager = (NotificationManager) context.getSystemService(ns);
    int icono = R.drawable.mydrawable;
    CharSequence textoEstado = superior;
    long hora = System.currentTimeMillis();
    Notification notif = new Notification(icono, textoEstado, hora);
    Context contexto = context.getApplicationContext();
    CharSequence titulo = title;
    CharSequence descripcion = body;
    PendingIntent contIntent;
    if(url.equalsIgnoreCase("NULL"))
    {
        Intent notIntent = new Intent(contexto,MainActivity.class);
        contIntent = PendingIntent.getActivity(
                contexto, 0, notIntent, 0);
    } …Run Code Online (Sandbox Code Playgroud) 我正在使用谷歌推送通知,到目前为止它工作得很好,目前推送通知不起作用,因为 onRegistered 从未启动。我认为问题出在清单中(因为问题是接收者从未被调用),但我不确定
这是我的清单
    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.name.name"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="8" />
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>     
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.SEND_SMS" />
     <uses-permission android:name="android.permission.WRITE_SMS"/>
     <uses-permission android:name="android.permission.RECEIVE_SMS" />
     <uses-permission android:name="android.permission.READ_SMS" />
     <uses-permission android:name="android.permission.RESTART_PACKAGES"/>
     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
     <uses-permission android:name="com.name.name.permission.C2D_MESSAGE" android:protectionLevel="normal" />  
    <application
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.name.name.Disclaimer"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" /> …Run Code Online (Sandbox Code Playgroud) android push-notification google-cloud-messaging android-broadcast
我从谷歌播放控制台收到一些错误,其中一些用户(Pixel XL,nexus 5和Xperia Z3 +)正在获得
Caused by: java.lang.RuntimeException: javax.crypto.BadPaddingException: pad block corrupted
at com.darwins.custom.ObscuredSharedPreferences.decrypt(ObscuredSharedPreferences.java:193)
at com.darwins.custom.ObscuredSharedPreferences.getInt(ObscuredSharedPreferences.java:134)
Run Code Online (Sandbox Code Playgroud)
该应用程序在其余设备上工作正常(即使在一些nexus 5工作正常)
当用户第一次打开应用程序时,问题出现了,它尝试从共享首选项加载音乐卷.由于他们从未在选项菜单中输入以更改默认值,因此应获取默认值:
if(sp      == null) sp = new ObscuredSharedPreferences(ctx, ctx.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE));
if(musicVolume == -1) musicVolume = sp.getInt(KEY_SP_MUSIC_VOLUME,10);
Run Code Online (Sandbox Code Playgroud)
如果我们从ObsucredSharedPreferences输入getInt:
@Override
public int getInt(String key, int defValue) {
    final String v = delegate.getString(key, null);
    return v!=null ? Integer.parseInt(decrypt(v)) : defValue;
}
Run Code Online (Sandbox Code Playgroud)
因此,getString我没有得到null值,而是得到像"ERKJFER89er"这样的值(我从不在首选项中写入该值,否则它应该在每个手机上崩溃)所以当它试图解密该值时,它期望一个int值,它抛出一个javax.crypto.BadPaddingException: pad block corrupted我不知道如何解决这个或如何解决这个问题,任何想法将是apreciate
解密代码:
protected String decrypt(String value){
    try {
        final byte[] bytes = value!=null ? Base64.decode(value,Base64.DEFAULT) : new …Run Code Online (Sandbox Code Playgroud) 我正在我的Android应用程序中集成Firebase分析,但我无法在文档或谷歌中看到我如何添加测试设备,因此它不依赖于统计数据.
我测试了很多,所以如果它计算我自己的事件,我的主要统计数据将被破坏
我很高兴
 AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("70A9E11F73EREFF712A1B73AE2BC2945")
            .addTestDevice("1D18F0345E4C90E3625DB344BE64D02E")
            .build();
Run Code Online (Sandbox Code Playgroud) 我有一个UICollectionView的项目数组(有2列和3行),我想用indexPath访问它但我不能使用它
如果我使用indexPath.row或indexPath.item我得到0,1,0,1,0,1.
如果我使用indexPath.section我得到0,0,1,1,2,2
我想要的是0,1,2,3,4,5,6
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
MenuCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
//cell.backgroundColor = [UIColor redColor ];
cell.backgroundColor = [UIColor whiteColor ];
UIImage* imagenprobar =[UIImage imageNamed: [imagenes objectAtIndex: indexPath.item]];
[cell.imagen setImage: imagenprobar];
cell.label.text = [textos objectAtIndex: indexPath.item];
return cell;
Run Code Online (Sandbox Code Playgroud)
}
我已经在我的统一游戏中实现了 firebase crashlytics 以接收崩溃报告,并且它正在以一半的燃料工作。它报告了一些崩溃,但由于某种原因,它没有报告所有崩溃。我收到了大量来自用户在游戏同一部分崩溃的报告,但我无法重现该问题或在 crashlytics 报告中找到它。
为了收到所有崩溃信息,我还可以做些什么吗?
我是Firebase的新手,我正在努力理解它,我想跟踪我的用户解锁的whitch成就(按我的身份)
我看了很多帖子关于这个喜欢这个地方说,
目前,仅在建议事件的子集上提供参数报告.如果您需要访问自定义参数,可以将应用程序链接到BigQuery并对原始数据运行查询.
所以据我所知,它应该显示建议事件的值,但我甚至没有得到这些值,我得到事件而不是值,我的控制台没有显示值.
我在代码上做的不好吗?我误解了事件?或者Firebase无法正常工作?
代码发送到firebase我的id
 Bundle bundle = new Bundle();
 bundle.putString(FirebaseAnalytics.Param.ACHIEVEMENT_ID, Integer.toString(lm.logros[a].id));
 mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.UNLOCK_ACHIEVEMENT, bundle);
Run Code Online (Sandbox Code Playgroud) android ×6
firebase ×3
crashlytics ×1
git ×1
git-pull ×1
git-push ×1
ios ×1
macos ×1
nexus-5 ×1
nsindexpath ×1
sony-xperia ×1
toast ×1
xcode ×1