小编Jam*_*ald的帖子

Google Play会显示隐含的READ_EXTERNAL_STORAGE权限

当在Google I/O上宣布Android 4.1 JellyBean(API 16)时,它引入了以下权限:

READ_EXTERNAL_STORAGE

提供对外部存储的受保护读访问.在Android 4.1中,默认情况下所有应用程序仍具有读取权限.这将在将来的版本中进行更改,以要求应用程序使用此权限明确请求读取访问权限.如果您的应用程序已经请求写访问权限,它也将自动获得读取权限.有一个新的开发人员选项可以打开读取访问限制,开发人员可以根据Android将来的行为来测试他们的应用程序.

http://developer.android.com/about/versions/android-4.1.html#Permissions

我有一个tagets API 16的应用程序,需要WRITE_EXTERNAL_STORAGE权限.我准备部署更新,并注意到READ_EXTERNAL_STORAGE权限现在在开发人员门户中列为必需权限.对于上周部署的更新,它未在Google Play中列为必需的权限.此应用程序未显式请求READ_EXTERNAL_STORAGE权限.

已经为此应用程序授予WRITE_EXTERNAL_STORAGE权限的用户是否会在更新应用程序时被提示授予其他隐式READ_EXTERNAL_STORAGE权限?

更新:

我们已经发布了应用程序,JellyBean设备会自动更新,而不会请求READ_EXTERNAL_STORAGE权限.在我明确声明READ_EXTERNAL_STORAGE要求的未来版本中,是否会要求已授予WRITE_EXTERNAL_STORAGE权限的用户授予READ_EXTERNAL_STORAGE权限?

permissions android google-play

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

在iPhone 3GS上消耗100%CPU的后台线程会导致潜在的主线程

在我的应用程序中,我在NSOperationQueue中执行10个异步NSURLConnections作为NSInvocationOperations.为了防止每个操作在连接有机会完成之前返回,我调用CFRunLoopRun(),如下所示:

- (void)connectInBackground:(NSURLRequest*)URLRequest {
 TTURLConnection* connection = [[TTURLConnection alloc] initWithRequest:URLRequest delegate:self];

 // Prevent the thread from exiting while the asynchronous connection completes the work.  Delegate methods will
 // continue the run loop when the connection is finished.
 CFRunLoopRun();

 [connection release];
}
Run Code Online (Sandbox Code Playgroud)

连接完成后,最终连接委托选择器调用CFRunLoopStop(CFRunLoopGetCurrent())以恢复connectInBackground()中的执行,允许它正常返回:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    TTURLConnection* ttConnection = (TTURLConnection*)connection;
    ...
    // Resume execution where CFRunLoopRun() was called.
    CFRunLoopStop(CFRunLoopGetCurrent());
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {  
    TTURLConnection* ttConnection = (TTURLConnection*)connection;
    ...
    // Resume execution where CFRunLoopRun() was called.
 CFRunLoopStop(CFRunLoopGetCurrent());
} …
Run Code Online (Sandbox Code Playgroud)

iphone cpu multithreading cocoa-touch objective-c

10
推荐指数
1
解决办法
6210
查看次数

在TeamCity上使用kotlin编译android项目失败

我的构建步骤使用TeamCity中的gradle构建模板但不幸的是我得到:

[16:29:22][:presentation:compileLocalDebugKotlin] Using kotlin incremental compilation
[16:29:48][:presentation:compileLocalDebugKotlin] Compilation with Kotlin compile daemon was not successful
[16:29:48][:presentation:compileLocalDebugKotlin] java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
[16:29:48][:presentation:compileLocalDebugKotlin]   java.io.EOFException
[16:29:48][:presentation:compileLocalDebugKotlin]   at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:229)
[16:29:48][:presentation:compileLocalDebugKotlin]   at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
Run Code Online (Sandbox Code Playgroud)

关于为什么我会得到这个的任何想法?

teamcity continuous-integration android travis-ci kotlin

9
推荐指数
2
解决办法
1041
查看次数

Espresso 2.0 - 在扩展junit3测试用例的类中使用@Test注释的方法

Method annotated with @Test inside class extending junit3 testcase使用ActivityInstrumentationTestCase2Espresso 2.0附带的新类时,我收到了一个奇怪的警告.

我的课程看起来就像谷歌提供的那样:

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static android.support.test.espresso.matcher.ViewMatchers.assertThat;
import static org.hamcrest.Matchers.notNullValue;

@RunWith(AndroidJUnit4.class)
@LargeTest
public class MyCoolActivityTests extends ActivityInstrumentationTestCase2<MyCoolActivity> {

    private MyCoolActivity mActivity;

    public MyCoolActivityTests() {
        super(MyCoolActivity.class);
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();
        injectInstrumentation(InstrumentationRegistry.getInstrumentation());
        mActivity = getActivity();
    }

    @Test
    public void checkPreconditions() {
        assertThat(mActivity, notNullValue());
        // Check that Instrumentation was correctly injected in …
Run Code Online (Sandbox Code Playgroud)

java android android-testing android-espresso

6
推荐指数
1
解决办法
5088
查看次数

从内置的Android样式中获取主题属性

鉴于已主题使用上下文AppTheme(如下图所示),是否有可能以编程方式获取颜色#ff11cc00没有引用R.style.MyButtonStyle,R.style.AppThemeandroid.R.style.Theme_Light

目标是获取由主题设置的按钮文本颜色,而不受特定主题或应用程序声明的资源的约束.使用android.R.style.Widget_Button并且android.R.attr.textColor没关系.

<style name="AppTheme" parent="Theme.Light">
    <item name="android:buttonStyle">@style/MyButtonStyle</item>
</style>

<style name="MyButtonStyle" parent="android:style/Widget.Button">
    <item name="android:textColor">#ff11cc00</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android android-theme android-styles

5
推荐指数
1
解决办法
644
查看次数