- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用了来自 repo 的完全相同的代码:
https://github.com/pcess/tutorials/tree/master/SplashPermissions
repo 中的独立应用程序运行完全正常。但是,当在我的应用程序中实现相同的代码时,权限会陷入循环,应用程序不会授予任何权限。
list 文件:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.******.dms_IN"
android:versionCode="6"
android:versionName="5.7.0">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.******.dms_IN"
android:versionCode="6"
android:versionName="5.7.0">
<application
android:name="com.******.screen.MyApp"
android:allowBackup="false"
android:icon="@mipmap/icon_new"
android:label="@string/ApplicationName"
android:largeHeap="true"
android:theme="@style/MyCustomTheme">
<activity
android:name="com.******.screen.SplashPermissionsActivity"
android:label="@string/ApplicationName">
</activity>
<activity android:name="com.******.screen.FirstTimePermission"
android:label="@string/ApplicationName"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.******.screen.StartActivity"
android:label="@string/ApplicationName"
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.******.screen.ColgateDMSWelcome"
android:label="@string/ApplicationName"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.Setup"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.MyGridView"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.******.screen.ProdOrderBooking"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.******.screen.OrderBookingSummary"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.OrderBookingView"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.OrderSummary"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.OrderBookingKPI"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.SKUWiseSummary"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.******.screen.BTWrapperActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme" />
<activity
android:name="com.******.screen.CallSheetSummary"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.MSSStore"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity
android:name="com.******.screen.SalesmanKPI"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.Salesman_KPI_Re"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity
android:name="com.******.screen.CustomerSummary"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.SchemeList"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.CashCollection"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.RouteList"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="com.******.screen.ListAsDialog"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="com.******.map.Map"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="com.******.screen.NotificationView"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" />
<activity
android:name="com.******.signature.CaptureSignature"
android:screenOrientation="portrait" />
<activity
android:name="com.******.screen.ImageViewer"
android:screenOrientation="portrait" /> <!-- [START firebase_service] -->
<service android:name="com.******.PushNotify.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service> <!-- [END firebase_service] -->
<!-- [START firebase_iid_service] -->
<service
android:name="com.******.PushNotify.MyFirebaseInstanceIDService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<activity android:name="com.******.screen.CreateCustomer" />
</application>
</manifest>
代码:
FirstTimePermission Activity :
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import java.util.Set;
public class FirstTimePermission extends Activity {
/*
* ---------------------------------------------
*
* Private Fields
*
* ---------------------------------------------
*/
/**
* The time that the splash screen will be on the screen in milliseconds.
*/
private int timeoutMillis = 5000;
/** The time when this {@link Activity} was created. */
private long startTimeMillis = 0;
/** The code used when requesting permissions */
private static final int PERMISSIONS_REQUEST = 1234;
/** A random number generator for the background colors. */
private static final Random random = new Random();
/**
* The TextView which is used to inform the user whether the permissions are
* granted.
*/
private TextView textView = null;
private static final int textViewID = View.generateViewId();
/*
* ---------------------------------------------
*
* Getters
*
* ---------------------------------------------
*/
/**
* Get the time (in milliseconds) that the splash screen will be on the
* screen before starting the {@link Activity} who's class is returned by
* {@link #getNextActivityClass()}.
*/
public int getTimeoutMillis() {
return timeoutMillis;
}
/** Get the {@link Activity} to start when the splash screen times out. */
@SuppressWarnings("rawtypes")
public Class getNextActivityClass() {
return StartActivity.class;
}
/**
* Get the list of required permissions by searching the manifest. If you
* don't think the default behavior is working, then you could try
* overriding this function to return something like:
*
* <pre>
* <code>
* return new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
* </code>
* </pre>
*/
public String[] getRequiredPermissions() {
String[] permissions = null;
try {
permissions = getPackageManager().getPackageInfo(getPackageName(),
PackageManager.GET_PERMISSIONS).requestedPermissions;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (permissions == null) {
return new String[0];
} else {
return permissions.clone();
}
}
/*
* ---------------------------------------------
*
* Activity Methods
*
* ---------------------------------------------
*/
@TargetApi(23)
@Override
protected void onCreate(Bundle savedInstanceState) {
/** Default creation code. */
super.onCreate(savedInstanceState);
/** Create the layout that will hold the TextView. */
LinearLayout mainLayout = new LinearLayout(this);
mainLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));
/** Add a TextView and set the initial text. */
textView = new TextView(this);
textView.setTextSize(50);
textView.setId(textViewID);
textView.setText("Waiting for permissions...");
mainLayout.addView(textView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
/** Set the background color. */
int off = 128;
int rest = 256 - off;
int color = Color.argb(255, off + random.nextInt(rest), off + random.nextInt(rest), off + random.nextInt(rest));
mainLayout.setBackgroundColor(color);
/** Set the mainLayout as the content view */
setContentView(mainLayout);
/**
* Save the start time of this Activity, which will be used to determine
* when the splash screen should timeout.
*/
startTimeMillis = System.currentTimeMillis();
/**
* On a post-Android 6.0 devices, check if the required permissions have
* been granted.
*/
if (Build.VERSION.SDK_INT >= 23) {
checkPermissions();
} else {
startNextActivity();
}
}
/**
* See if we now have all of the required dangerous permissions. Otherwise,
* tell the user that they cannot continue without granting the permissions,
* and then request the permissions again.
*/
@TargetApi(23)
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
if (requestCode == PERMISSIONS_REQUEST) {
checkPermissions();
}
}
/*
* ---------------------------------------------
*
* Other Methods
*
* ---------------------------------------------
*/
/**
* After the timeout, start the {@link Activity} as specified by
* {@link #getNextActivityClass()}, and remove the splash screen from the
* backstack. Also, we can change the message shown to the user to tell them
* we now have the requisite permissions.
*/
private void startNextActivity() {
runOnUiThread(() -> textView.setText("Permissions granted..."));
long delayMillis = getTimeoutMillis() - (System.currentTimeMillis() - startTimeMillis);
if (delayMillis < 0) {
delayMillis = 0;
}
new Handler().postDelayed(() -> {
startActivity(new Intent(FirstTimePermission.this, getNextActivityClass()));
finish();
}, delayMillis);
}
/**
* Check if the required permissions have been granted, and
* {@link #startNextActivity()} if they have. Otherwise
* {@link #requestPermissions(String[], int)}.
*/
private void checkPermissions() {
String[] ungrantedPermissions = requiredPermissionsStillNeeded();
if (ungrantedPermissions.length == 0) {
startNextActivity();
} else {
requestPermissions(ungrantedPermissions, PERMISSIONS_REQUEST);
}
}
/**
* Convert the array of required permissions to a {@link Set} to remove
* redundant elements. Then remove already granted permissions, and return
* an array of ungranted permissions.
*/
@TargetApi(23)
private String[] requiredPermissionsStillNeeded() {
Set<String> permissions = new HashSet<String>();
for (String permission : getRequiredPermissions()) {
permissions.add(permission);
}
for (Iterator<String> i = permissions.iterator(); i.hasNext();) {
String permission = i.next();
if (checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED) {
Log.d(SplashPermissionsActivity.class.getSimpleName(),
"Permission: " + permission + " already granted.");
i.remove();
} else {
Log.d(SplashPermissionsActivity.class.getSimpleName(),
"Permission: " + permission + " not yet granted.");
}
}
return permissions.toArray(new String[permissions.size()]);
}
Gradle (应用程序):
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.******.dms_IN"
minSdkVersion 24
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
implementation files('libs/BixolonPrinter.jar')
implementation files('libs/commons-codec.jar')
implementation files('libs/mpandroidchartlibrary-2-1-3.jar')
implementation files('libs/sc-light-jdk15on-1.47.0.2.jar')
implementation files('libs/android-sm_https_v2_IN.jar')
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.google.guava:guava:18.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'me.leolin:ShortcutBadger:1.1.16@aar'
implementation 'net.zetetic:android-database-sqlcipher:3.5.9@aar'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
}
apply plugin: 'com.google.gms.google-services'
最佳答案
您没有正确完成运行时权限。您的代码不运行 Android 6 及以上版本。按照这个 https://github.com/ArunaMahaGamage/Android-Runtime-Permission
您要在 Play 商店中发布您的应用。仔细检查通话和短信权限。如果您不需要这些权限,请将它们从 list 中删除。
关于Android Splash 运行时权限不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54779907/
正在构建一个使用一些 Azure 服务和 Scrapy-Splash 的 python Scrapy 应用程序。我尝试在本地 Windows 计算机中使用 scrapinghub/splash:lat
Unhandled promise rejection: Error: No native splash screen registered for given view controller. Ca
我使用这个 link 安装了 Splash .按照所有步骤进行安装,但 Splash 不起作用。 我的settings.py 文件: BOT_NAME = 'Teste' SPIDER_MODULES
我首先使用以下命令在 docker 上运行splash: docker run -p 8050:8050 scrapinghub/splash 当我转到端口 8050 并尝试渲染时: http://w
我使用了来自 repo 的完全相同的代码: https://github.com/pcess/tutorials/tree/master/SplashPermissions repo 中的独立应用程序
我有一个初始图像,它会在页面加载时随我的软件一起加载。 在窗口的当前大小(1024 像素)下,图像以居中方式加载,但是当窗口开始最大化时,它太靠左了。 这是我的CSS: #splash { wid
我有一个应用程序需要在启动前或在后台闲置一段时间后获取一些远程配置文件。我使用加载器 View Controller 来完成这项工作,同时显示带有加载指示器的初始屏幕。 显示加载程序的最佳方式是什么(
我正在尝试抓取 Google Scholar search results并获取与搜索匹配的每个结果的所有 BiBTeX 格式。现在我有一个带有 Splash 的 Scrapy 爬虫。我有一个 lua
我正在尝试将 scrapy 与启动和旋转代理一起使用。这是我的 settings.py: ROBOTSTXT_OBEY = False BOT_NAME = 'mybot' SPIDER_MODULE
我正在使用 FFMPEG 制作包含单个单色 JPG 图像的视频: ffmpeg -y -loop 1 -framerate 30 -t 5 -i SplashBW.jpg Splash.mp4 生成的
我正在尝试使用 fbi 为 Raspbian Stretch 提供启动画面。根据一些教程,我在这里找到了我的情况: /etc/systemd/system/splashscreen.service [
我正在使用Scrapy + Splash来爬网网页,并尝试从google广告横幅和其他广告中提取数据,但是我很难弄清楚要遵循xpath的方式。 我正在使用Scrpay-Splash API渲染页面,以
我已经成功使用此链接通过Tor运行Scrapy:http://pkmishra.github.io/blog/2013/03/18/how-to-run-scrapy-with-TOR-and-mul
我正在尝试抓取一个网站,但需要在所有页面中使用启动画面,因为它们的内容是动态创建的。现在它只呈现第一页,而不是内容页或分页页。 代码如下: import scrapy from scrapy_spla
我想在 Splash 随着时间结束时更改 viewController;我有这个: //Implementación de los métodos: - (void) cargaImagenes{
对于预先知道其个人资料 url 的几个 Disqus 用户中的每一个,我想抓取他们的姓名和他们的关注者的用户名。我正在使用 scrapy 和 splash 这样做。但是,当我解析响应时,它似乎总是在抓
我想做什么 在 avito.ru(俄罗斯房地产网站)上,某人的电话在您点击它之前是隐藏的。我想用Scrapy+Splash收集手机。 示例网址:https://www.avito.ru/moskva/
我正在尝试通过 Python 脚本调用 Splash 来呈现和抓取交互式网站,基本上遵循此 tutorial : import scrapy from scrapy_splash import Spl
我设法使用 scrapy+splash 连接到网站(感谢 this thread )。 我知道我已登录,因为我可以显示您登录后可用的一些元素。但是,当我尝试使用另一个 SplashRequest 访问
当我运行 cordova-splash 命令时出现此错误。获取未处理的错误事件 > > $ cordova-splash > > Checkin
我是一名优秀的程序员,十分优秀!